# delimit ;
clear;
*version 12;
set matsize 400;
set more off;

log using "/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Models/CreatingTables.log", replace;

**************************************************************;
*Author: Jeff Carter                                         *;
*Date: Friday, July 1, 2016                         *;
**************************************************************;

use "/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Data/TermLimitsAnalysisData.dta", clear;


** Unconditional Table for Paper **;

logit cwinit lameduck hawkish  rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store index1model;

logit cwinit lameduck hawkish2  rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store index2model;

logit cwinit lameduck milservice  rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);


drop _est_index1model _est_index2model _est_milmodel ;



** Conditional Table for Paper **;

logit cwinit lameduck hawkish lameduck_hawkish rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store index1model;

logit cwinit lameduck hawkish2 lameduck_hawkish2 rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store index2model;

logit cwinit lameduck milservice lameduck_mil rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);


drop _est_index1model _est_index2model _est_milmodel ;




*********************************************;
***          Unconditional Models         ***;
*********************************************
    
use "/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Data/TermLimitsAnalysisData.dta", clear;

*** Full Specification  ***;

logit cwinit lameduck hawkish   rivalry numbord parliament gender civwar  rgdppc gdpgrowthpct majpow mm peace peace2 peace3   ,  robust;
estimates store index1model;

logit cwinit lameduck hawkish2   rivalry numbord parliament gender civwar  rgdppc gdpgrowthpct majpow mm peace peace2 peace3   ,  robust;
estimates store index2model;

logit cwinit lameduck milservice   rivalry numbord parliament gender civwar  rgdppc gdpgrowthpct majpow mm peace peace2 peace3   ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Conflict Severity  ***;

gen wardv2 = 0;
replace wardv2 = 1 if cwinit == 1 & wardv == 0;
replace wardv2 = 2 if wardv == 1;

ologit wardv2 lameduck hawkish   rivalry numbord parliament gender  peace peace2 peace3   ,  robust;
estimates store index1model;

ologit wardv2 lameduck hawkish2   rivalry numbord parliament gender  peace peace2 peace3   ,  robust;
estimates store index2model;

ologit wardv2 lameduck milservice   rivalry numbord parliament gender  peace peace2 peace3   ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Multiple Initiations  ***;

** Have to do in R **;


*** Single vs. Multiple Mandates  ***;

logit cwinit  lameduckone lameducktwo hawkish  rivalry numbord parliament gender peace peace2 peace3 ,  robust;
estimates store index1model;

logit cwinit  lameduckone lameducktwo hawkish2  rivalry numbord parliament gender peace peace2 peace3 ,  robust;
estimates store index2model;

logit cwinit  lameduckone lameducktwo milservice  rivalry numbord parliament gender peace peace2 peace3 ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;



*** Time Trend  ***;

logit cwinit lameduck hawkish  rivalry numbord parliament gender peace peace2 peace3 year  ,  robust;
estimates store index1model;

logit cwinit lameduck hawkish2  rivalry numbord parliament gender peace peace2 peace3 year  ,  robust;
estimates store index2model;

logit cwinit lameduck milservice  rivalry numbord parliament gender peace peace2 peace3 year  ,  robust;
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Year Fixed Effects  ***;

clogit cwinit lameduck hawkish  rivalry numbord parliament gender peace peace2 peace3 , robust   group(year);
estimates store index1model;

clogit cwinit lameduck hawkish2  rivalry numbord parliament gender peace peace2 peace3 , robust   group(year);
estimates store index2model;

clogit cwinit lameduck milservice  rivalry numbord parliament gender peace peace2 peace3 , robust   group(year);
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Decade Fixed Effects  ***;

clogit cwinit lameduck hawkish  rivalry numbord parliament gender peace peace2 peace3 , robust   group(decade);
estimates store index1model;

clogit cwinit lameduck hawkish2  rivalry numbord parliament gender peace peace2 peace3 , robust   group(decade);
estimates store index2model;

clogit cwinit lameduck milservice  rivalry numbord parliament gender peace peace2 peace3 , robust   group(decade);
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Lagged Explanatory Variables  ***;


destring leadidarchigos, generate(id) ignore("A" "-" ".");
xtset id year;

** Confounding Model   **;

logit cwinit l.lameduck l.hawkish  l.rivalry l.numbord l.parliament l.gender 
            l.peace l.peace2 l.peace3 ,  robust;
estimates store index1model;


logit cwinit l.lameduck l.hawkish2  l.rivalry l.numbord l.parliament l.gender 
            l.peace l.peace2 l.peace3 ,  robust;
estimates store index2model;

logit cwinit l.lameduck l.milservice  l.rivalry l.numbord l.parliament l.gender 
            l.peace l.peace2 l.peace3 ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Regional Fixed Effects  ***;

clogit cwinit lameduck hawkish rivalry numbord parliament gender peace peace2 peace3 ,  group(region);
estimates store index1model;

clogit cwinit lameduck hawkish2 rivalry numbord parliament gender peace peace2 peace3 ,  group(region);
estimates store index2model;

clogit cwinit lameduck milservice rivalry numbord parliament gender peace peace2 peace3 ,  group(region);
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;




*** Variation in Military Service  ***;

logit cwinit  lameduck  combat milnoncombat  rivalry numbord parliament gender peace peace2 peace3  ,  robust;
estimates store combatmodel;

logit cwinit  lameduck militarycareer  milnoncareer  rivalry numbord parliament gender peace peace2 peace3  ,  robust;
estimates store servicemodel;

estout  combatmodel servicemodel milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_combatmodel _est_servicemodel  ;









*********************************************;
***        Conditional Models             ***;
*********************************************;

use "/Users/Jeff/Dropbox/TermLimits/D6/Analysis/Data/TermLimitsAnalysisData.dta", clear;

*** Full Specification  ***;

logit cwinit lameduck hawkish lameduck_hawkish   rivalry numbord parliament gender civwar  rgdppc gdpgrowthpct majpow mm peace peace2 peace3   ,  robust;
estimates store index1model;

logit cwinit lameduck hawkish2 lameduck_hawkish2   rivalry numbord parliament gender civwar  rgdppc gdpgrowthpct majpow mm peace peace2 peace3   ,  robust;
estimates store index2model;

logit cwinit lameduck milservice lameduck_mil   rivalry numbord parliament gender civwar  rgdppc gdpgrowthpct majpow mm peace peace2 peace3   ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Conflict Severity  ***;

gen wardv2 = 0;
replace wardv2 = 1 if cwinit == 1 & wardv == 0;
replace wardv2 = 2 if wardv == 1;

ologit wardv2 lameduck hawkish lameduck_hawkish   rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store index1model;

ologit wardv2 lameduck hawkish2 lameduck_hawkish2   rivalry numbord parliament gender peace peace2 peace3   ,  robust;
estimates store index2model;

ologit wardv2 lameduck milservice lameduck_mil   rivalry numbord parliament gender  peace peace2 peace3   ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Multiple Initiations  ***;

** Have to do in R **;


*** Single vs. Multiple Mandates  ***;

logit cwinit  lameduckone lameducktwo hawkish lameduck_hawkish  rivalry numbord parliament gender peace peace2 peace3 ,  robust;
estimates store index1model;

logit cwinit  lameduckone lameducktwo hawkish2 lameduck_hawkish2  rivalry numbord parliament gender peace peace2 peace3 ,  robust;
estimates store index2model;

logit cwinit  lameduckone lameducktwo milservice lameduck_mil  rivalry numbord parliament gender peace peace2 peace3 ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;



*** Time Trend  ***;

logit cwinit lameduck hawkish lameduck_hawkish  rivalry numbord parliament gender peace peace2 peace3 year  ,  robust;
estimates store index1model;

logit cwinit lameduck hawkish2 lameduck_hawkish2  rivalry numbord parliament gender peace peace2 peace3 year  ,  robust;
estimates store index2model;

logit cwinit lameduck milservice lameduck_mil  rivalry numbord parliament gender peace peace2 peace3 year  ,  robust;
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Year Fixed Effects  ***;

clogit cwinit lameduck hawkish lameduck_hawkish  rivalry numbord parliament gender peace peace2 peace3 , robust   group(year);
estimates store index1model;

clogit cwinit lameduck hawkish2 lameduck_hawkish2  rivalry numbord parliament gender peace peace2 peace3 , robust   group(year);
estimates store index2model;

clogit cwinit lameduck milservice lameduck_mil  rivalry numbord parliament gender peace peace2 peace3 , robust   group(year);
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Decade Fixed Effects  ***;

clogit cwinit lameduck hawkish lameduck_hawkish  rivalry numbord parliament gender peace peace2 peace3 , robust   group(decade);
estimates store index1model;

clogit cwinit lameduck hawkish2 lameduck_hawkish2  rivalry numbord parliament gender peace peace2 peace3 , robust   group(decade);
estimates store index2model;

clogit cwinit lameduck milservice lameduck_mil  rivalry numbord parliament gender peace peace2 peace3 , robust   group(decade);
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Lagged Explanatory Variables  ***;


destring leadidarchigos, generate(id) ignore("A" "-" ".");
xtset id year;

** Confounding Model   **;

logit cwinit l.lameduck l.hawkish l.lameduck_hawkish  l.rivalry l.numbord l.parliament l.gender 
            l.peace l.peace2 l.peace3 ,  robust;
estimates store index1model;


logit cwinit l.lameduck l.hawkish2 l.lameduck_hawkish2  l.rivalry l.numbord l.parliament l.gender 
            l.peace l.peace2 l.peace3 ,  robust;
estimates store index2model;

logit cwinit l.lameduck l.milservice l.lameduck_mil  l.rivalry l.numbord l.parliament l.gender 
            l.peace l.peace2 l.peace3 ,  robust;
estimates store milmodel;

estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;


*** Regional Fixed Effects  ***;

clogit cwinit lameduck hawkish lameduck_hawkish rivalry numbord parliament gender peace peace2 peace3 ,  group(region);
estimates store index1model;

clogit cwinit lameduck hawkish2 lameduck_hawkish2 rivalry numbord parliament gender peace peace2 peace3 ,  group(region);
estimates store index2model;

clogit cwinit lameduck milservice lameduck_mil rivalry numbord parliament gender peace peace2 peace3 ,  group(region);
estimates store milmodel;


estout  index1model index2model milmodel, style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_index1model _est_index2model _est_milmodel ;





*** Variation in Military Service  ***;

logit cwinit  lameduck  combat lameduck_combat milnoncombat lameduck_noncombat rivalry numbord parliament gender peace peace2 peace3  ,  robust;
estimates store combatmodel;

logit cwinit  lameduck militarycareer lameduck_milcareer milnoncareer lameduck_milnoncareer  rivalry numbord parliament gender peace peace2 peace3  ,  robust;
estimates store servicemodel;

estout  combatmodel servicemodel , style(tex) cells(b(star fmt(2)) se(par fmt(2))) stats(N chi2 p ll) starlevels(+ 0.10 * 0.05 ** 0.01);
drop _est_combatmodel _est_servicemodel  ;






log close;

